<?php

/**
 * index.php - application root
 *
 * This file demonstrates the rich information that can be included in
 * in-code documentation through DocBlocks and tags.
 * @author Hasantha Liyanage
 * @version 1.0
 * @package root
 */



/**
 * include files for the page
 *
 * require_once 'library/config.php';
 * require_once 'library/category-functions.php';
 * require_once 'library/product-functions.php';
 * require_once 'library/cart-functions.php';
 * require_once 'library/common-functions.php';
 */
require_once 'library/config.php';
require_once 'library/category-functions.php';
require_once 'library/product-functions.php';
require_once 'library/cart-functions.php';
require_once 'library/common-functions.php';

$_SESSION['shop_return_url'] = $_SERVER['REQUEST_URI'];

$catId  = (isset($_GET['c']) && $_GET['c'] != '1') ? $_GET['c'] : 0;
$pdId   = (isset($_GET['p']) && $_GET['p'] != '') ? $_GET['p'] : 0;
$pgNav   = (isset($_GET['n']) && $_GET['n'] != '') ? $_GET['n'] : 0;

require_once 'include/header.php';
?> 
<table width="800" border="0" align="center" cellpadding="0" cellspacing="0" class="frame" >
  <tr> 
    <td colspan="3"> 
      <?php require_once 'include/top.php'; ?>
    </td>
  </tr>
  <tr> 
    <td colspan="3" align="center" style = "width:774px; height:30px; background:url(resource/images/navbg.jpg) 0 0 repeat-x;"> 
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          
          <td width="24%"> 
            <?php require_once 'include/branchList.php'; ?>
          </td>
          <td width="75%"> 
            <?php  require_once 'include/miniCart.php'; ?>
          </td>
          <td width="5%">&nbsp;</td>
        </tr>
      </table> </td>
  </tr>
  <tr valign="top"> 
    <td width="535" height="265"   id="leftnav" align="center" valign="bottom"> 
      <img src="resource/images/Vegetable%2001.jpg" width="531" height="263" /> 
    </td>
    <td align="center" ></td>
    <td  rowspan="3" align="center" class="leftNav" > 
      <?php require_once 'include/leftNav.php'; ?>
    </td>
    <td width="1" align="center" ></td>
  </tr>
  <tr valign="top"> 
    <td height="10" align="center"></td>
    <td align="center" ></td>
  </tr>
  <tr valign="top"> 
    <td><table width="98%" border="0" cellspacing="0" cellpadding="0">
        <tr> 
          <td> 
            <?php
if ($pdId) {
	require_once 'include/productDetail.php';
} else if ($catId) {
	require_once 'include/productList.php';
} else if($pgNav == 3){
	require_once 'content/home.php';
} else if($pgNav == 4){
	require_once 'content/about.php';
} else if($pgNav == 6){
	require_once 'content/help.php';
} else{
	require_once 'content/home.php';
}
?>
          </td>
        </tr>
      </table></td>
    <td width="1" align="left"> <img src="resource/images/bodybg.jpg" alt="" width="1" height="400"/></td>
  </tr>
  <tr> 
    <td colspan="3"> 
      <?php
		require_once 'include/footer.php';
	  ?>
    </td>
  </tr>
</table>
